package com.arithmeticEveryDay.blueBridge;

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class BuyOneAddOne {
    
    static Scanner scan = new Scanner(System.in);
    
    int n;
    PriorityQueue<Integer> goods;

    private BuyOneAddOne(int n, PriorityQueue<Integer> goods) {
        super();
        this.n = n;
        this.goods = goods;
    }
    public int getLeastMoney() {
        int leastMoney = 0;
        int count = 0;
        while (!goods.isEmpty()) {
            int buy = goods.poll();
            leastMoney += buy;
            count++;
            if (count == 2) {
                for (Integer i : goods) {
                    if (i <= buy / 2) {
                        goods.remove(i);
                        break;
                    }
                }
                count = 0;
            }
        }
        return leastMoney;
    }


    public static void main(String[] args) {
        int n = scan.nextInt();
        Comparator<Integer> c = new Comparator<Integer>() {

            @Override
            public int compare(Integer o1, Integer o2) {
                if (o1 > o2) {
                    return -1;
                } else if(o1 < o2) {
                    return 1;
                }
                return 0;
            }
            
        };
        PriorityQueue<Integer> goods = new PriorityQueue<Integer>(n, c);
        for (int i = 0; i < n; i++) {
            goods.add(scan.nextInt());
        }
        BuyOneAddOne b = new BuyOneAddOne(n, goods);
        System.out.println(b.getLeastMoney());

    }

}
